package com.zlp.spring.init.component;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.stereotype.Component;
/**
 * 自定义 MyBeanFactoryPostProcessor
 * @date: 2022/1/13 16:28
 */
@Component
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {



    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {

      /*  String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames();
        for (String beanDefinitionName : beanDefinitionNames) {
            System.out.println(beanDefinitionName);
        }*/


        // 设置Spring创建对象注入模型
//        GenericBeanDefinition beanService = (GenericBeanDefinition) beanFactory.getBean("userService");
//        beanService.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR);

    }
}
